CC = g++
#EXT=`perl cpuflags.pl`
#FLAGS = -O3 -Wall $(EXT)
FLAGS = -O3 -Wall -ffast-math
#FLAGS = -O7 -Wall -mfpmath=sse -march=pentium4 -msse -ffast-math -mmmx -m3dnow -msse2
#FLAGS = -O7 -Wall -mfpmath=sse,387 -march=k8 -msse -mmmx -m3dnow -ffast-math -m64 -msse2 -mcpu=k8
#FLAGS = -mcpu=pentium3 -O7 -Wall -march=pentium3 -mfpmath=sse -msse -mmmx -mtune=pentium3 

all:	cav chan fsv sol tun vdw vol

cavity:	cav
cavities:	cav
channel:	chan
channels:	chan
fsvcalc:	fsv
solvent:	sol
tunnel:	tun
volume:	vol

cav:	utils-main.o utils-output.o cavities.cpp
	$(CC) $(FLAGS) -o Cavities.exe utils-main.o utils-output.o cavities.cpp
	chmod 777 Cavities.exe
	mv Cavities.exe ../bin

chan:	utils-main.o utils-output.o channel.cpp
	$(CC) $(FLAGS) -o Channel.exe utils-main.o utils-output.o channel.cpp
	chmod 777 Channel.exe
	mv Channel.exe ../bin

fsv:	utils-main.o utils-output.o fsv_calc.cpp
	$(CC) $(FLAGS) -o FsvCalc.exe utils-main.o utils-output.o fsv_calc.cpp
	chmod 777 FsvCalc.exe
	mv FsvCalc.exe ../bin

sol:	utils-main.o utils-output.o solvent.cpp
	$(CC) $(FLAGS) -o Solvent.exe utils-main.o utils-output.o solvent.cpp
	chmod 777 Solvent.exe
	mv Solvent.exe ../bin

tun:	utils-main.o utils-output.o tunnel.cpp
	$(CC) $(FLAGS) -o Tunnel.exe utils-main.o utils-output.o tunnel.cpp
	chmod 777 Tunnel.exe
	mv Tunnel.exe ../bin

vdw:	utils-main.o utils-output.o vdw.cpp
	$(CC) $(FLAGS) -o VDW.exe utils-main.o utils-output.o vdw.cpp
	chmod 777 VDW.exe
	mv VDW.exe ../bin

vol:	utils-main.o utils-output.o volume.cpp
	$(CC) $(FLAGS) -o Volume.exe utils-main.o utils-output.o volume.cpp
	chmod 777 Volume.exe
	mv Volume.exe ../bin

utils-main.o:	utils-main.cpp
	$(CC) $(FLAGS) -c -o utils-main.o utils-main.cpp

utils-output.o:	utils-main.o utils-output.cpp
	$(CC) $(FLAGS) -c -o utils-output.o utils-output.cpp

clean:
	rm -f *.o  *~

distclean:
	rm -f *.o ../bin/*.exe *~

none:	
	echo "Please type make xxx, where xxx = cav, cha, fsv, sol, tun, vdw, or vol"
